
clear
cd ""
use "data/crisis.dta", clear
keep year iso_num iso country rgdppc cpi tloans lang bankeq30decline panic bank_failures bank_equity_crisis union2crisis crisisJST

merge 1:1 iso year using "data/f.dta"
tsset iso_num year
sort iso_num year

by iso_num: gen GDP_growth = (rgdppc / L.rgdppc - 1)*100 
qui gen rcredit_loan = tloans/cpi
by iso_num: gen credit_growth = (rcredit_loan/ L.rcredit_loan - 1)*100

qui tab year, gen(yr)
drop yr1

qui gen Finance_sentiment_growth = all_stdscore - L.all_stdscore

tvdiff Finance_sentiment_growth bankeq30decline yr*, model(fe) pre(5) post(5) vce(cluster iso_num) test_tt graph save_graph(fsg_bankeq30decline) 
tvdiff Finance_sentiment_growth bankeq30decline credit_growth GDP_growth yr*, model(fe) pre(5) post(5) vce(cluster iso_num) test_tt graph save_graph(fsg_bankeq30decline) 
graph save fsg_did_bankeq30decline, replace
graph export "output.pdf",replace

